package cn.com.b2office.struts2.action;

import java.util.Date;
import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import cn.com.b2office.domain.PrepayApply;
import cn.com.b2office.domain.User;

import com.opensymphony.xwork2.ActionSupport;

public class AddPrepayAppAction extends ActionSupport implements SessionAware {

	private static final long serialVersionUID = 6845750310220703697L;

	private Map session = null;

	private String addressId = null;

	private int amount = 0;

	private int needinv = 0;

	private String invtitle = null;

	private String invtype = null;

	public void setSession(Map session) {
		this.session = session;
	}

	public String execute() throws Exception {
		User user = (User) session.get("user");
		if (user == null)
			return "login";
		PrepayApply app = new PrepayApply();
		app.setMemberId(user.getMemberId());
		app.setAmount(amount);
		app.setNeedinv(needinv);
		if (needinv == 1) {
			app.setInvtitle(invtitle);
			app.setInvtype(invtype);
		}
		app.setModifytime(new Date());
		return SUCCESS;
	}

}
